<include file="Public::header" />
			<div class="content-box"><!-- Start Content Box -->
				
				<div class="content-box-header">
					
					<h3>添加文章</h3>
					<div class="clear"></div>
					
				</div> <!-- End .content-box-header -->
				
				<div class="content-box-content">
                    <div class="tab-content" id="tab2">
					
						<form action="{:U('main/articleEditPost')}" method="post">
							
							<fieldset> <!-- Set class to "column-left" or "column-right" on fieldsets to divide the form into columns -->
								<p>
									<label><span class="c1">*</span>选择分类：</label>              
									<select name="cate" class="small-input">
										<option value="0">请选择分类</option>
                                        <volist name="cate" id="vo">
                                            <php>dump($vo);dump($data);</php>
                                            <option value="<php>echo $vo['cid'].','.$vo['cname']</php>" <php>echo ($vo['cid']==$data['cid']) ? 'selected="selected"' : '';</php>>{$vo.cname}</option>
                                        </volist>
									</select> 
								</p>
                                <p>
									<label><span class="c1">*</span>标题：</label>
										<input class="text-input large-input" type="text" id="title" name="title" value="{$data.title}"/>
										<br /><small>80字以内</small>
								</p>
                                <p>
									<label>来源：</label>
										<input class="text-input large-input" type="text" id="title" name="author" value="{$data.author}"/>
										<br /><small>如果想加入文章来源并且链接，请输入类似"腾讯,http://www.qq.com"字样。</small>
								</p>                                
								<p>
									<label>链接：</label>
									<input class="text-input medium-input datepicker" type="text" id="link" name="keywords" value="{$data.link}"/>
                                    <br /><small>填写的URL后将不显示内容,直接跳转至链接地址。</small>
								</p>						
								<p>
									<label>关键字：</label>
									<input class="text-input medium-input datepicker" type="text" id="keywords" name="keywords" value="{$data.keywords}"/>
                                    <br /><small>多关键字请使用“,”号隔开</small>
								</p>
								<p>
									<label>摘要：</label>
									<textarea class="text-input textarea" id="abstract" name="abstract" cols="79" rows="4">{$data.abstract}</textarea>
                                    <br /><small>255字以内</small>
								</p>
								<p>
									<label>内容：</label>
									<textarea class="text-input textarea" id="content" name="content" cols="79" rows="25">{$data.content}</textarea>
								</p>
                                <php>if ($att){</php>
                                <p style="background:#eee;padding-left:10px;">
 									<label>附件：</label>
                                    <volist name="att" id="v">
                                        <span style="width:240px;display:inline-block;margin-bottom:10px;">
                                            <img src="/u/{$v.path}" width="75px" style="display:block;"/>
                                            <a href="/u/{$v.path}" target="_blank" class="att">{:substr($v['path'],9)}</a>&nbsp;&nbsp;&nbsp;&nbsp;
                                            <a style="color:red;" href="javascript:;" class="attDel" att_id="{$v.att_id}">删除</a>
                                        </span>
                                    </volist>
                                    <br /><small>如果删除文中的图片,别忘了在此处删除图片文件。</small>    
                                </p>
                                <php>}</php>
								<p>
									<label>是否显示：</label>
									<input type="radio" name="is_display" value="1" <php>echo ($data['is_display'] == 1) ? 'checked="checked"' : '';</php>  />显示 
									<input type="radio" name="is_display" value="2" <php>echo ($data['is_display'] == 2) ? 'checked="checked"' : '';</php> />发布但不显示
								</p>
								<p>
									<input class="button" type="submit" value="提交" />
                                    <input type="hidden" name="aid" value="{$data.aid}" />
								</p>
								
							</fieldset>
							
							<div class="clear"></div><!-- End .clear -->
							
						</form>
						
					</div> <!-- End #tab2 --> 					
				</div> <!-- End .content-box-content -->
			</div> <!-- End .content-box -->
<include file="Public::footer" />
<script type="text/javascript">
$(function(){
    var plugins={
        Code:{c:'btnCode',t:'插入代码',h:1,e:function(){
                var _this=this;
                var htmlCode='<div><select id="xheCodeType"><option value="html">HTML/XML</option><option value="js">Javascript</option><option value="css">CSS</option><option value="php">PHP</option><option value="java">Java</option><option value="py">Python</option><option value="pl">Perl</option><option value="rb">Ruby</option><option value="cs">C#</option><option value="c">C++/C</option><option value="vb">VB/ASP</option><option value="">其它</option></select></div><div><textarea id="xheCodeValue" wrap="soft" spellcheck="false" style="width:300px;height:100px;" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="确定" /></div>';			var jCode=$(htmlCode),jType=$('#xheCodeType',jCode),jValue=$('#xheCodeValue',jCode),jSave=$('#xheSave',jCode);
                jSave.click(function(){
                        _this.loadBookmark();
                        _this.pasteText('[code='+jType.val()+']\r\n'+jValue.val()+'\r\n[/code]');
                        _this.hidePanel();
                        return false;	
                });
                _this.showDialog(jCode);
        }},
        Flv:{c:'btnFlv',t:'插入Flv视频',h:1,e:function(){
                var _this=this;
                var htmlFlv='<div>Flv文件:&nbsp; <input type="text" id="xheFlvUrl" value="http://" class="xheText" /></div><div>宽度高度: <input type="text" id="xheFlvWidth" style="width:40px;" value="480" /> x <input type="text" id="xheFlvHeight" style="width:40px;" value="400" /></div><div style="text-align:right;"><input type="button" id="xheSave" value="确定" /></div>';
                var jFlv=$(htmlFlv),jUrl=$('#xheFlvUrl',jFlv),jWidth=$('#xheFlvWidth',jFlv),jHeight=$('#xheFlvHeight',jFlv),jSave=$('#xheSave',jFlv);
                jSave.click(function(){
                        _this.loadBookmark();
                        _this.pasteText('[flv='+jWidth.val()+','+jHeight.val()+']'+jUrl.val()+'[/flv]');
                        _this.hidePanel();
                        return false;	
                });
                _this.showDialog(jFlv);
        }},
        map:{c:'btnMap',t:'插入Google地图',e:function(){
                var _this=this;
                _this.showIframeModal('Google 地图','googlemap/googlemap.html',function(v){_this.pasteHTML('<img src="'+v+'" />');},538,404);
        }}
    },emots={
        msn:{name:'MSN',count:40,width:22,height:22,line:8},
        pidgin:{name:'Pidgin',width:22,height:25,line:8,list:{smile:'微笑',cute:'可爱',wink:'眨眼',laugh:'大笑',victory:'胜利',sad:'伤心',cry:'哭泣',angry:'生气',shout:'大骂',curse:'诅咒',devil:'魔鬼',blush:'害羞',tongue:'吐舌头',envy:'羡慕',cool:'耍酷',kiss:'吻',shocked:'惊讶',sweat:'汗',sick:'生病',bye:'再见',tired:'累',sleepy:'睡了',question:'疑问',rose:'玫瑰',gift:'礼物',coffee:'咖啡',music:'音乐',soccer:'足球',good:'赞同',bad:'反对',love:'心',brokenheart:'伤心'}},
        ipb:{name:'IPB',width:20,height:25,line:8,list:{smile:'微笑',joyful:'开心',laugh:'笑',biglaugh:'大笑',w00t:'欢呼',wub:'欢喜',depres:'沮丧',sad:'悲伤',cry:'哭泣',angry:'生气',devil:'魔鬼',blush:'脸红',kiss:'吻',surprised:'惊讶',wondering:'疑惑',unsure:'不确定',tongue:'吐舌头',cool:'耍酷',blink:'眨眼',whistling:'吹口哨',glare:'轻视',pinch:'捏',sideways:'侧身',sleep:'睡了',sick:'生病',ninja:'忍者',bandit:'强盗',police:'警察',angel:'天使',magician:'魔法师',alien:'外星人',heart:'心动'}}
    }; 
    $('#content').xheditor({
        plugins:plugins,
        tools:'full',
        showBlocktag:false,
        forcePtag:false,
        beforeSetSource:ubb2html,
        beforeGetSource:html2ubb,
        emots:emots,
        emotMark:true,
        html5Upload:false,
        upLinkUrl:"{:U('main/upload')}",
        upLinkExt:"zip,rar,txt",
        upImgUrl:"{:U('main/upload')}",
        upImgExt:"jpg,jpeg,gif,png,bmp",
        upFlashUrl:"{:U('main/upload')}",
        upFlashExt:"swf",
        upMediaUrl:"{:U('main/upload')}",
        upMediaExt:"avi"});
    $('#abstract').xheditor({
        tools:'simple',
        beforeSetSource:ubb2html,
        beforeGetSource:html2ubb
    })
    $('.attDel').click(function(){
        var $att_id = $(this).attr('att_id');
        var $this_dom = $(this).parent('span');
        $.post("{:U('main/attDel')}",{ 'att_id':$att_id },function(data){
            if(data == 1){
                $this_dom.remove();
            }else{
                alert('删除失败');
            }
        },'json');
    })
})
</script>